package org.study.user.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.study.user.model.User;

import javax.servlet.http.HttpServletRequest;

public class UserUtils {

    public static User getNowUser(){
        HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return (User) req.getSession().getAttribute("user");
    }
}
